/**
# plug_jvlibjs - JV Libries Javascript
# @version 1.0
# ------------------------------------------------------------------------
# author    Open Source Code Solutions Co
# copyright Copyright (C) 2011 joomlavi.com. All Rights Reserved.
# @license - http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL or later.
# Websites: http://www.joomlavi.com
# Technical Support:  http://www.joomlavi.com/my-tickets.html
-------------------------------------------------------------------------*/

if (!JVLib) {
    var JVLib, J, j;
    (function () {
        var loadElement = function (key, url) {
            var head = document.getElementsByTagName('head')[0];
            var script = document.createElement('script');
            script.type = 'text/javascript';
            script.src = url;
            head.appendChild(script);
        }
        var pathLib = '';
        var scriptAdded = {};
        var readyEvent = [];
        JVLib = {
            load: function (key, url) {
                if($type(key) == 'array'){
                    key.each(function(k){
                        J.load(k);
                    });
                    return this;
                }
                
                if (!key) { alert('Please insert key to import function'); return this }
                if (scriptAdded[key] != undefined) return this;
                if (!url) var url = pathLib + key + '.js';
                loadElement(key, url);
                scriptAdded[key] = false;
                return this;
            },
            path: function (p) {
                if (p) pathLib = p;
                return pathLib;
            }
        }
        J = j = JVLib;
    })();
}